package cn.lgy.basis.controller;

import cn.lgy.basis.util.ServletUtil;
import com.github.pagehelper.PageHelper;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * web层通用数据处理
 */
public class BaseController {

    /**
     * 设置请求分页数据
     */
    protected void startPage() {
        Integer pageNo = ServletUtil.getParameterToInt("pageNo");
        Integer pageSize = ServletUtil.getParameterToInt("pageSize");
        if (pageNo != null && pageSize != null) {
            PageHelper.startPage(pageNo, pageSize);
        }
    }

    /**
     * 获取request
     */
    public HttpServletRequest getRequest() {
        return ServletUtil.getRequest();
    }

    /**
     * 获取response
     */
    public HttpServletResponse getResponse() {
        return ServletUtil.getResponse();
    }

}
